﻿Imports System.Text
Imports Monadic

<TestClass()>
Public Class FunctiveTests

    ''' <summary>
    ''' Pis this instance.
    ''' </summary>
    <TestMethod()>
    Public Sub Pi()
        Dim f As Func(Of Integer, Double) = Function(k) 4 * (Math.Pow(-1, k) / ((2.0 * k) + 1))
        Dim calculatePi = Aggregate x In f Into Sum()
        Assert.AreEqual(3.14159, calculatePi(200000), 7)
    End Sub

End Class
